<template>
  <div>
    <navbar>
      <div slot="left" class="left" @click="esc">
        <img src="~assets/img/common/fanhui.svg" alt="" />
      </div>
      <div slot="center" class="titles">
        <div
          v-for="(item, index) in titles"
          :key="index"
          class="titles-item"
          @click="indexshow(index)"
          :class="{ active: index == currentindex }"
        >
          {{ item }}
        </div>
      </div>
    </navbar>
  </div>
</template>

<script>
import Navbar from "components/common/navbar/navbar.vue";
export default {
  name: "detailnavbarshow",
  data() {
    return {
      titles: ["商品", "参数", "评论", "推荐"],
      currentindex: 0,
    };
  },
  components: {
    Navbar,
  },
  methods: {
    indexshow(index) {
      this.currentindex = index;
      this.$emit("navindex", index);
    },
    esc() {
      this.$router.go(-1);
    },
  },
};
</script>

<style scoped>
.titles {
  display: flex;
}
.titles-item {
  flex: 1;
  font-size: 13px;
}
.active {
  color: var(--color-high-text);
}
.left img {
  height: 10px;
}
</style>